package com.xxx.dit.service.impl;


import com.github.pagehelper.PageHelper;
import com.xxx.dit.domain.DictItem;
import com.xxx.dit.mapper.DictItemMapper;
import com.xxx.dit.query.DictItemQuery;
import com.xxx.dit.service.IDictItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictItemServiceImpl implements IDictItemService {
    @Autowired
    private DictItemMapper dictItemMapper;

    @Override
    public List<DictItem> findAll() {
        return dictItemMapper.findAll();
    }

    @Override
    public DictItem findOne(long id) {
        return dictItemMapper.findOne(id);
    }

    @Override
    public List<DictItem> queryPage(DictItemQuery dictItemQuery) {
        PageHelper.startPage(dictItemQuery.getCurrentPage(), dictItemQuery.getPageSize());
        return dictItemMapper.queryPage(dictItemQuery);
    }

    @Override
    public void addDictItem(DictItem dictItem) {
        dictItemMapper.addDictItem(dictItem);
    }

    @Override
    public void updateDictItem(DictItem dictItem) {
        dictItemMapper.updateDictItem(dictItem);
    }

    @Override
    public void deleteDictItem(long id) {
        dictItemMapper.deleteDictItem(id);
    }

    @Override
    public void batchDictItems(long[] ids) {
        dictItemMapper.batchDictItems(ids);
    }

    @Override
    public List<DictItem> findByDictId(Long dictId) {
        PageHelper.clearPage();
        return dictItemMapper.findByDictId(dictId);
    }
}
